/*
 * Helper.h
 *
 *  Created on: 26/06/2011
 *      Author: george
 */

#ifndef HELPER_H_
#define HELPER_H_

namespace dataStruct {

	class Helper {
	public:
		static bool isPrime(const int x){
			for (int i = 3; i*i <= x; i += 2){
				if ( x%i == 0 ){
					return false;
				}
			}
			return true;
		}

		static int nextPrime(int x){
			if ( x % 2 == 0 ) x++;
			for (; !Helper::isPrime(x); x+=2 );

			return x;
		}

	};
}

#endif /* HELPER_H_ */
